package com.ruoyi.oos.web.controller.overrun;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.druid.util.StringUtils;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.oos.overrun.service.IOverrunRecordCalSelfService;

@Controller
@RequestMapping("/overrun/calSelf")
public class OverturnRecordSelfCalAction extends BaseController {
	
	 private String prefix = "overrun/recordSelf";
	
	 @Autowired
	 IOverrunRecordCalSelfService overrunRecordCalService;
	 
	 @GetMapping()
	 public String calData() {
		// overrunRecordCalService.calOverrunRecord(DateUtils.addDays(new Date(), -1));
		   return prefix + "/calData";
	 }
	 //
	 @RequestMapping(value="calDataJson",method=RequestMethod.POST)
	 @ResponseBody
	 public String calDataJson( String startTime, String endTime) {
		 if(StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)) {
			 return "-1";
		 }
		 Long userId = ShiroUtils.getUserId();
		 overrunRecordCalService.calOverrunRecordSelf(startTime, endTime, userId);
		 return "success";
	 }
	 
	 
	 

}
